package com.med.controller;

import com.med.service.AddressService;
import com.med.vo.AddressVO;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/address")
public class AddressController extends BaseController {
    @Autowired
    private AddressService addressService;
//    查询用户地址
    @RequestMapping("/query")
    public TableDataInfo queryAddressMessage(AddressVO addressVO) {
        return getDataTable(addressService.queryAddressMessage(addressVO));
    }

    //    添加新地址
    @RequestMapping("/insert")
    public AjaxResult insertAddress(AddressVO addressVO) {
        return toAjax(addressService.insertAddress(addressVO));
    }
//    删除地址

    @RequestMapping("/delete")
    public AjaxResult deleteAddress(AddressVO addressVO) {
        return toAjax(addressService.deleteAddress(addressVO));
    }
//修改地址
    @RequestMapping("/update")
    public AjaxResult updateAddress(AddressVO addressVO) {
        return toAjax(addressService.updateAddress(addressVO));
    }
//    查询单条地址
    @RequestMapping("/queryone")
    public TableDataInfo queryOneAddress(AddressVO addressVO) {
        System.out.println(addressVO);
        return getDataTable(addressService.queryOneAddress(addressVO));
    }




}
